<script setup lang="ts">
import { ref } from 'vue'

const isShow = ref(true)
const toggle = () => {
  isShow.value = !isShow.value
}
</script>

<template>
  <button @click="toggle">显示隐藏</button>
  <hr />
  <div v-show="isShow" class="box"></div>
  <div v-if="isShow" class="box"></div>
</template>

<style>
.box {
  width: 200px;
  height: 200px;
  background-color: #fff;
}
</style>
